<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message"/>
     <style type="text/css">
        .ecol1 { vertical-align: top; padding-right : 25px }
        .ecol2 { vertical-align: top; border-left: #ACBECE 1px solid; padding-left : 10px }
        .rich-calendar-tool-btn{
            font-family: Arial, Verdana;
        } 
    </style>
    
    
    <h:form id="navioForm">

        <rich:panel>
            <f:facet name="header">Navio</f:facet>
    
            <s:decorate id="nameDecoration" template="layout/edit.xhtml">
                <ui:define name="label">Nome</ui:define>
                <h:inputText id="name" required="true"
                             value="#{navioHome.instance.nome}"/>
            </s:decorate>
            
            <s:decorate id="numeroDecoration" template="layout/edit.xhtml">
                <ui:define name="label">Numero</ui:define>
                <h:inputText id="numero" required="false"
                             value="#{navioHome.instance.numero}"/>
            </s:decorate>
            
            <s:decorate id="idadeDecoration" template="layout/edit.xhtml">
                <ui:define name="label">Data de Fabricacao</ui:define>
                <a4j:outputPanel id="calendar" layout="block">
                    <rich:calendar value="#{navioHome.instance.idade}" 
                    	popup="true"
                        datePattern="dd/MM/yyy"
                        showApplyButton="false" cellWidth="24px" cellHeight="22px" style="width:200px"/>
            	</a4j:outputPanel>
                
            </s:decorate>
            
            <div style="clear:both"/>
            
        </rich:panel>
        <rich:spacer height="5px"/>
        <rich:panel>
            	<f:facet name="header">Cabines</f:facet>
            	<rich:dataTable id="cabineList" var="cabine"
				value="#{navioHome.instance.cabines}" rows="10"
				rendered="#{not empty navioHome.instance.cabines}">
				<rich:column>
					<f:facet name="header">Numero</f:facet>
					<s:link id="numero" value="#{cabine.numero}" view="/cabine.xhtml">
						<f:param name="cabineId" value="#{cabine.id}" />
					</s:link>
				</rich:column>
				<rich:column>
					<f:facet name="header">Tipo</f:facet> 
					<s:link id="classe" value=" #{cabine.tipoClasse.descricao}" view="/cabine.xhtml">
						<f:param name="cabineId" value="#{cabine.id}" />
					</s:link>
                                    
                </rich:column>				
			</rich:dataTable>
            </rich:panel>
		
        <div class="actionButtons">
            <h:commandButton id="save" 
                          value="Salvar" 
                         action="#{navioHome.persist}"
                       rendered="#{!navioHome.managed}"/>                   
            <h:commandButton id="update" 
                          value="Salvar" 
                         action="#{navioHome.update}"
                       rendered="#{navioHome.managed}"/>                  
            <h:commandButton id="delete" 
                          value="Excluir" 
                         action="#{navioHome.remove}"
                      immediate="true"
                       rendered="#{navioHome.managed}"/>
            <s:button propagation="end" 
                               id="done" 
                            value="Voltar"
                             view="/navioList.xhtml"/>
        </div>
        
    </h:form>
    
</ui:define>

</ui:composition>

